<?php

class Application_Model_User
{
	protected $_name;
	protected $_created;
	protected $_mobile_tel;
	protected $_home_tel;
	protected $_email;
	protected $_password;
	protected $_id;
	protected $_default_addrid;
	protected $_user_group;
	protected $_certificate_type;
	protected $_certificate_num;

	public function __construct(array $options = null)
	{
		if (is_array($options)) {
			$this->setOptions($options);
		}
	}
	
	public function __set($name, $value)
	{
		$method = 'set' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid user property');
		}
		$this->$method($value);
	}
	
	public function __get($name)
	{
		$method = 'get' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid user property');
		}
		return $this->$method();
	}
	
	public function setOptions(array $options)
	{
		$methods = get_class_methods($this);
		foreach ($options as $key => $value) {
			$method = 'set' . ucfirst($key);
			if (in_array($method, $methods)) {
				$this->$method($value);
			}
		}
		return $this;
	}
	
	public function setMobileTel($mobile_tel){
		$this->_mobile_tel = (string) $mobile_tel;
		return $this;
	}
	
	public function getMobileTel(){
		return $this->_mobile_tel;
	}
	
	public function setHomeTel($home_tel){
		$this->_home_tel = (string) $home_tel;
		return $this;
	}
	
	public function getHomeTel(){
		return $this->_home_tel;
	}
	
	public function setDefaultAddrId($default_addid){
		$this->_default_addrid = (int) $default_addid;
		return $this;
	}
	
	public function getDefaultAddrId(){
		return $this->_default_addrid;
	}
	
	public function setUserGroup($user_group){
		$this->_user_group = (int) $user_group;
		return $this;
	}
	
	public function getUserGroup(){
		return $this->_user_group;
	}
	
	public function setCertificateNum($certificate_num){
		$this->_certificate_num = (string) $certificate_num;
		return $this;
	}
	
	public function getCertificateNum(){
		return $this->_certificate_num;
	}
	
	public function setCertificateType($certificate_type){
		$this->_certificate_type = (string) $certificate_type;
		return $this;
	}
	
	public function getCertificateType(){
		return $this->_certificate_type;
	}
	
	public function setName($text)
	{
		$this->_name = (string) $text;
		return $this;
	}
	
	public function getName()
	{
		return $this->_name;
	}
	
	public function setPassword($pword)
	{
		$this->_password = (string) $pword;
		return $this;
	}
	
	public function getPassword()
	{
		return $this->_password;
	}
	
	public function setEmail($email)
	{
		$this->_email = (string) $email;
		return $this;
	}
	
	public function getEmail()
	{
		return $this->_email;
	}
	
	public function setCreated($ts)
	{
		$this->_created = $ts;
		return $this;
	}
	
	public function getCreated()
	{
		return $this->_created;
	}
	
	public function setId($id)
	{
		$this->_id = (int) $id;
		return $this;
	}
	
	public function getId()
	{
		return $this->_id;
	}
	
	
	
}

